layui.use(['form', 'layer'], function () {

    var form = layui.form,
        layer = parent.layer === undefined ? layui.layer : top.layer,
        $ = layui.jquery;


    var iframeName = 0;
    var _iframe = parent.window.frames[iframeName];
    var $iframe = $($('.layui-layer-iframe', parent.document).find("iframe")[0].contentWindow.document);

    // 选中图标
    $('.doc-icon li').on('click', function () {
        var class_name = $(this).find('i').attr('data-class');
        console.log(class_name);

        if (class_name) {
            //$(_iframe.document).find('.icon_name').val(class_name);
            $iframe.find('.icon_name').val(class_name);
            $iframe.find('.icon_design').find('i').removeClass().addClass('layui-icon ' + class_name);

            layer.msg('选择成功', {icon: 1, time: 1000});
        }

        var index = parent.layer.getFrameIndex(window.name);
        layer.close(index);
    });
});
